home *** CD-ROM | disk | FTP | other *** search
- Path: labdien.cc.columbia.edu!ski1
- From: ski1@labdien.cc.columbia.edu (Sam Inala)
- Newsgroups: comp.lang.c
- Subject: Re: How can I use huge || very small number?
- Date: 5 Apr 1996 04:23:36 GMT
- Organization: Columbia University
- Message-ID: <4k2788$85f@apakabar.cc.columbia.edu>
- References: <315681F3.314D@blue.nowcom.co.kr> <4joh0l$jch@news.acns.nwu.edu>
- Reply-To: ski1@columbia.edu
- NNTP-Posting-Host: labdien.cc.columbia.edu
- Keywords: 1000 factorial
-
- Thus spake muzaffar@casbah.acns.nwu.edu (Usman Muzaffar):
- >In article <315681F3.314D@blue.nowcom.co.kr>,
- >whoever <whatever@blue.nowcom.co.kr> wrote:
- >>may be it is FAQ but...
- >>how can I compute 10000! or 0.12345......
- >
- >10000! is a very, very big number.
- >I'm not sure it's even representable by standard IEEE fp notation.
-
- One approach that I haven't seen mentioned is this:
-
- 1000! = exp( log( 1000 ! ) )
-
- Let sum = Sum( log10( i ), i=1..1000 )
-
- The integer part of sum is your exponent, as a power of 10.
- The mantissa is 10 to the sum power.
-
- --
- 'Til next time, \o/ \o/
- V \o/ V email: ski1@columbia.edu
- <> Sam Inala <> V
-